import { FilterDTO } from "@/utils/api/interface";
import i18n from "@/language";
//默认每页显示条数
export const defaultPageSize = 15;

export const initFilter = {
    offset: 0,
    size: defaultPageSize,
}

export function getPage(total: number, onFilterChange: (val: FilterDTO) => void) {
    return {
        total: total,
        defaultPageSize: defaultPageSize,
        pageSizeOptions: [15, 30, 50, 100],
        showSizeChanger: true,
        showTotal: (total: number) => i18n.t("total") + ": " + total,
        onChange: (page: number, pageSize: number) => {
            onFilterChange({ offset: (page - 1) * pageSize, size: pageSize })
        }
    }
}